<?php
namespace app\blog\form;

use app\common\loglic\Form;

class Type extends Form
{
    public function items($data=[])
    {
        return [
            'type_id' => [
                'type'        => 'hidden',
                'value'       => $data['type_id'],
            ],
            'type_parent' => [
                'type'        => 'select',
                'value'       => $data['type_parent'],
                'option'      => model('blog/Type','loglic')->listOptionLevel(0),
                'required'    => true,
                'title'       => '父级分类',
                'class_row'   => 'col-2 mb-3',
            ],
            'type_status' => [
                'type'        => 'select',
                'value'       => $data['type_status'],
                'option'      => model('common/Attr','loglic')->status(),
                'required'    => true,
                'title'       => '显示状态',
                'class_row'   => 'col-2 mb-3',
            ],
            'type_menu' => [
                'type'        => 'select',
                'value'       => intval($data['type_menu']),
                'option'      => model('common/Attr','loglic')->group(),
                'title'       => '菜单分组',
                'class_row'   => 'col-2 mb-3',
            ],
            'type_weight' => [
                'type'        => 'number',
                'value'       => intval($data['type_weight']),
                'required'    => true,
                'title'       => '排序权重',
                'class_row'   => 'col-2 mb-3',
                'class_input' => 'form-control form-control-sm text-center',
            ],
            'type_limit' => [
                'type'        => 'number',
                'value'       => intval($data['type_limit']),
                'required'    => true,
                'title'       => '每页数量',
                'class_row'   => 'col-2 mb-3',
                'class_input' => 'form-control form-control-sm text-center',
            ],
            'type_count' => [
                'type'        => 'number',
                'value'       => intval($data['type_count']),
                'required'    => true,
                'title'       => '数据统计',
                'class_row'   => 'col-2 mb-3',
                'class_input' => 'form-control form-control-sm text-center',
            ],
            'type_name' => [
                'type'        => 'text',
                'value'       => $data['type_name'],
                'required'    => true,
                'title'       => '分类名称',
                'maxlength'   => 30,
                'class_row'   => 'col-6 mb-3',
            ],
            'type_slug' => [
                'type'        => 'text',
                'value'       => $data['type_slug'],
                'required'    => false,
                'title'       => '唯一标识',
                'placeholder' => '留空自动生成',
                'class_row'   => 'col-6 mb-3',
            ],
            'type_cover' => [
                'type'        => 'image',
                'value'       => $data['type_cover'],
                'required'    => false,
                'title'       => '竖版封面',
                'class_row'   => 'col-6 mb-3',
            ],
            'type_slide' => [
                'type'        => 'image',
                'value'       => $data['type_slide'],
                'required'    => false,
                'title'       => '横版封面',
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'type_tpl' => [
                'type'        => 'text',
                'value'       => $data['type_tpl'],
                'required'    => false,
                'title'       => '列表页模板',
                'class_row'   => 'col-6 mb-3',
            ],
            'type_tpl_detail' => [
                'type'        => 'text',
                'value'       => $data['type_tpl_detail'],
                'required'    => false,
                'title'       => '详情页模板',
                'class_row'   => 'col-6 mb-3',
            ],
            'type_excerpt' => [
                'type'        => 'textarea',
                'value'       => $data['type_excerpt'],
                'required'    => false,
                'title'       => '分类描述',
                'rows'        => 3,
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'type_title' => [
                'type'        => 'textarea',
                'value'       => $data['type_title'],
                'required'    => false,
                'title'       => 'SEO标题',
                'rows'        => 3,
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'type_keywords' => [
                'type'        => 'textarea',
                'value'       => $data['type_keywords'],
                'required'    => false,
                'title'       => 'SEO关键字',
                'rows'        => 3,
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
            'type_description' => [
                'type'        => 'textarea',
                'value'       => $data['type_description'],
                'required'    => false,
                'title'       => 'SEO描述',
                'rows'        => 3,
                'class_row'   => 'col-6 mb-3',
                'class_label' => 'form-label',
            ],
        ];
    }
}